package com.mzkj.wanjulaile.mobile.api.common.entity;

import com.mzkj.common.data.StatusCode;
import com.mzkj.wanjulaile.mobile.api.modules.account.entity.Account;
import com.mzkj.wanjulaile.mobile.api.modules.session.entity.Session;

import java.io.Serializable;

/**
 * ResultEntity接口统一返回类
 * Created by wangxw on 2016/11/21.
 */
public class ResultEntity<RE> implements Serializable {

    private String statusCode;
    private String msg;
    private Session session;
    private RE data;

    public ResultEntity() {
    }

    public ResultEntity(String statusCode) {
        this.statusCode = statusCode;
    }

    public ResultEntity(String statusCode, String msg) {
        this.statusCode = statusCode;
        this.msg = msg;
    }

    public ResultEntity(StatusCode statusCode) {
        this.setStatusCode(statusCode.getValue());
        this.setMsg(statusCode.getDesc());
    }

    public ResultEntity(String statusCode, String msg, RE data) {
        this.statusCode = statusCode;
        this.msg = msg;
        this.data = data;
    }

    public ResultEntity(StatusCode statusCode, RE data) {
        this.statusCode = statusCode.getValue();
        this.msg = statusCode.getDesc();
        this.data = data;
    }

    public ResultEntity(StatusCode statusCode, RE data, Session session) {
        this.statusCode = statusCode.getValue();
        this.msg = statusCode.getDesc();
        this.data = data;
        this.session = session;
    }

    public ResultEntity(String statusCode, String msg, Session session, RE data) {
        this.statusCode = statusCode;
        this.msg = msg;
        this.session = session;
        this.data = data;
    }

    public String getStatusCode() {
        return statusCode;
    }

    public void setStatusCode(String statusCode) {
        this.statusCode = statusCode;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public RE getData() {
        return data;
    }

    public void setData(RE data) {
        this.data = data;
    }

    public Session getSession() {
        return session;
    }

    public void setSession(Session session) {
        this.session = session;
    }

    @Override
    public String toString() {
        return "ResultEntity{" +
                "statusCode='" + statusCode + '\'' +
                ", msg='" + msg + '\'' +
                ", session=" + session +
                ", data=" + data +
                '}';
    }
}
